import ajax from './request.config'
//办列
export const getPurOffList = ({
    name,
    typeUuid,
    supplier_uuid,
    status,
    startTime,
    endTime,
    pageNumber,
    pageSize
}) => ajax.get('/commodity/list', {
    params: {
        name,
        typeUuid,
        supplier_uuid,
        status,
        startTime,
        endTime,
        pageNumber,
        pageSize
    }
})
export const purOffFreezon = (uuid, flag) => ajax.post('/commodity/freezon', { uuid, flag })
export const deletePurOffList = uuid => ajax.post('/commodity/delete', { uuid })
export const saveOffPurList = ({
    uuid,
    name,
    supplier_uuid,
    type_uuid,
    image_url,
    brand,
    type_no,
    description,
    spec_name,
    price,
    remarks
}) => ajax.post('/commodity/save', {
    uuid,
    name,
    supplier_uuid,
    type_uuid,
    image_url,
    brand,
    type_no,
    description,
    spec_name,
    price,
    remarks
})
export const getVoucherTypeList = supplier_uuid => ajax.get('voucher/getType', { params: { supplier_uuid } })
export const getVoucherProvideList = scope => ajax.get('voucher/getSupplier', { params: { scope } })
export const getOffTypeList = supplier_uuid => ajax.get('commodity/getType', { params: { supplier_uuid } })
    //办型
export const getPurOffType = ({
    name,
    supplier_uuid,
    pageNumber,
    pageSize
}) => ajax.get('/commodityType/list', {
    params: {
        name,
        supplier_uuid,
        pageNumber,
        pageSize
    }
})
export const deletePurOffType = uuid => ajax.post('/commodityType/delete', { uuid })
export const saveAddPurOffType = ({
    uuid,
    name,
    supplier_uuid
}) => ajax.post("/commodityType/save", {
    uuid,
    name,
    supplier_uuid
})

//凭证列表
export const getVoucList = ({
    name,
    type_uuid,
    supplier_uuid,
    status,
    startTime,
    endTime,
    pageNumber,
    pageSize
}) => ajax.get("/voucher/list", {
    params: {
        name,
        type_uuid,
        supplier_uuid,
        status,
        startTime,
        endTime,
        pageNumber,
        pageSize
    }
})
export const purVoucFreezon = (uuid, flag) => ajax.post('/voucher/freezon', { uuid, flag })
export const deletePurVoucList = uuid => ajax.post('/voucher/delete', { uuid })
export const saveVoucPurList = ({
    uuid,
    name,
    supplier_uuid,
    type_uuid,
    description,
    inventorycode,
    unit,
    price,
    remarks
}) => ajax.post('/voucher/save', {
    uuid,
    name,
    supplier_uuid,
    type_uuid,
    description,
    inventorycode,
    unit,
    price,
    remarks
})

export const getPurVoucType = ({
    name,
    supplier_uuid,
    pageNumber,
    pageSize
}) => ajax.get('/voucherType/list', {
    params: {
        name,
        supplier_uuid,
        pageNumber,
        pageSize
    }
})
export const deletePurVoucType = uuid => ajax.post('/voucherType/delete', { uuid })
export const saveAddPurVoucType = ({
    uuid,
    name,
    supplier_uuid
}) => ajax.post("/voucherType/save", {
    uuid,
    name,
    supplier_uuid
})